/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.general.bc.ViaFacadeLocal;
import org.cip.esymons.general.be.Via;

/**
 *
 * @author ADMINISTRADOR
 */
public class ViaDelegate {

    private ViaFacadeLocal local;

    public ViaDelegate() {

        local = lookupViaFacade();
    }

    public void create(Via via){

        local.create(via);
    }

    public void edit(Via via){

        local.edit(via);
    }

    public void remove(Via via){

        local.remove(via);
    }

    public Via find(Object id){

        return local.find(id);
    }

    public List<Via> findAll(){

        return local.findAll();
    }

    private ViaFacadeLocal lookupViaFacade() {
        try {
            Context c = new InitialContext();
            return (ViaFacadeLocal) c.lookup("java:comp/env/ViaFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
}
